<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/14 0014
 * Time: 下午 15:37
 */

namespace frontend\widgets;


use yii\base\Widget;

class Loading extends Widget
{
    public $loadingImage = '/images/common/loading.gif';
    public $template = '<!-- 遮罩层DIV -->
                    <div id="overlay" class="overlay"></div>
                    <!-- Loading提示 DIV -->
                    <div id="loadingTip" class="loading-tip">
                        <img src="/images/common/loading.gif"/>
                    </div>';

    public function init()
    {
        $view = $this->view;
        $css = ".overlay {
            position: absolute;
            top: 0px;
            left: 0px;
            z-index: 10001;
            display: none;
            filter: alpha(opacity=20);
            background-color: #eeeeee;
            opacity: 0.2;
            -moz-opacity: 0.2;
        }
    
        .loading-tip {
            z-index: 10002;
            position: fixed;
            display: none;
        }
    
        .loading-tip img {
            width: 100px;
        }";
        $view->registerCss($css);
        parent::init(); // TODO: Change the autogenerated stub
    }

    public function run()
    {
        echo $this->template;
    }

    public function afterRun($result)
    {
        // $view = $this->getView();
        // $js = "";
        // $view->registerJs($js);
        return parent::afterRun($result); // TODO: Change the autogenerated stub
    }

}